<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/PartProgress/partProgressStep" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="partProgressStep" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <g:hiddenField name="docId" value="${params.docId}" />
            <g:hiddenField name="recpId" value="${params.recpId}" />
            <g:hiddenField name="state" value="${params.state}" />

            %{--<label >产品编码：</label>&nbsp;
            <input type="text" name="partName"  value="${partName}"/>
            <label >产品名称：</label>&nbsp;
            <input type="text" name="partDesc" value="${partDesc}"/>
            <label >产品图号：</label>&nbsp;
            <input type="text" name="group3" value="${group3}"/>
            <label >工序编码：</label>&nbsp;
            <input type="text" name="stepName" value="${stepName}"/>
            <label >工序名称：</label>&nbsp;
            <input type="text" name="stepDesc" value="${stepDesc}"/><br/>
            <label >大组类：</label>&nbsp;
            <input type="text" name="totalGroup" value="${totalGroup}"/>
            <label >小分类：</label>&nbsp;
            <input type="text" name="detailCate" value="${detailCate}"/>
            <label >批次号：</label>&nbsp;
            <input type="text" name="lotId" value="${lotId}"/>--}%
            %{--<label >时间段：</label>&nbsp;
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy-MM-dd"  data-toggle="datepicker" placeholder="FROM">
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy-MM-dd" data-toggle="datepicker" placeholder="TO">&nbsp;&nbsp;--}%
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/PartProgress/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${partProgressStep.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${partProgressStep.size()>0}">
                <g:each in="${partProgressStep}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='NORMAL_QTY'}">
                                <td name="progressNormalStep${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:if>
                            <g:elseif test="${headInstance=='REWORK_QTY'}">
                                <td name="progressReworkStep${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='OUTSRC_QTY'}">
                                <td name="progressOrcStep${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='SCRAP_QTY'}">
                                <td name="progressScrapStep${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance!='RN'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>

                    <td colspan="6">小计</td>
                    <td id="normalShowStep"></td>
                    <td id="reworkShowStep"></td>
                    <td id="orcShowStep"></td>
                    <td id="scrapShowStep"></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>

                    <td colspan="6">合计</td>
                    <td>${partProgressStepSumQty[0].SUM_NORMAL}</td>
                    <td>${partProgressStepSumQty[0].SUM_REWORK}</td>
                    <td>${partProgressStepSumQty[0].SUM_ORC}</td>
                    <td>${partProgressStepSumQty[0].SUM_SCRAP}</td>
                    <td></td>
                    <td></td>
                </tr>

            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/pagination" />

<script>
    $(function(){
        /*获取当页正常数量的小计*/
        var progressNStep=0
        for(var i=1;i<=${partProgressStep.size()};i++){
            var progressNoStep='progressNormalStep'+i
            var progressNorStep=$("td[name='"+progressNoStep+"']").text()==''?0:parseInt($("td[name='"+progressNoStep+"']").text());
            progressNStep+=progressNorStep
        }
        $("#normalShowStep").html(progressNStep);

        /*获取当页返修数量的小计*/
        var progressRStep=0
        for(var i=1;i<=${partProgressStep.size()};i++){
            var progressReStep='progressReworkStep'+i
            var progressRewStep=$("td[name='"+progressReStep+"']").text()==''?0:parseInt($("td[name='"+progressReStep+"']").text());
            progressRStep+=progressRewStep
        }

        $("#reworkShowStep").html(progressRStep);

        /*获取当页外协数量的小计*/
        var progressOStep=0
        for(var i=1;i<=${partProgressStep.size()};i++){
            var progressOrStep='progressOrcStep'+i
            var progressOrcStep=$("td[name='"+progressOrStep+"']").text()==''?0:parseInt($("td[name='"+progressOrStep+"']").text());
            progressOStep+=progressOrcStep
        }
        $("#orcShowStep").html(progressOStep);

        /*获取当页报废数量的小计*/
        var progressSStep=0
        for(var i=1;i<=${partProgressStep.size()};i++){
            var progressScStep='progressScrapStep'+i
            var progressScrStep=$("td[name='"+progressScStep+"']").text()==''?0:parseInt($("td[name='"+progressScStep+"']").text());
            progressSStep+=progressScrStep
        }
        $("#scrapShowStep").html(progressSStep);


    })
</script>

